﻿using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace FwProject.ShoppingMall.Com
{
    /// <summary>
    /// 内容管理
    /// </summary>
    [Table("contentManage")]
    public class ContentManage : Entity<Guid>, ICreationAudited
    {
        public const int TypeTitleLength = 50;

        /// <summary>
        /// 内容类别
        /// </summary>
        public Guid ContnetTypeId { get; set; }
        [ForeignKey("ContnetTypeId")]
        public virtual ContentType ContentType { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [MaxLength(TypeTitleLength)]
        public string Title { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 访问类别
        /// </summary>
        public AccessType AccessType { get; set; } = AccessType.Url;

        /// <summary>
        /// 数据（存url 或者 商品ID）
        /// </summary>
        public string Data { get; set; }

        public DateTime CreationTime { get; set; }

        public long? CreatorUserId { get; set; }
    }

    public enum AccessType : byte
    {
        [Display(Name = "网址")]
        Url,
        [Display(Name = "商品详情页")]
        Details
    }
}
